<?php
// no direct access
defined('_JEXEC') or die('Restricted access');

class TableMwc_Employee extends JTable {
    /**
     * Primary Key
     *
     * @var int
     */
    var $id = null;

    /**
     * @var string
     */
    var $name = null;

    /**
     * @var string
     */
    var $position = null;
    
    /**
     * @var int
     */
    var $dep_id = null;
    
    /**
     * @var string
     */
    var $email = null;
    
    /**
     * @var string
     */
    var $description = null;
    
    /**
     * @var string
     */
    var $image = null;
    
    /**
     * @var string
     */
    var $phone = null;
    
    /**
     * @var string
     */
    var $cellphone = null;
    
    /**
     * @var string
     */
    var $im = null;
    
    /**
     * @var string
     */
    var $link_im = null;
    
    /**
     * @var date
     */
    var $created = null;

    /**
     * @var int
     */
    var $published = null;

    /**
     * @var int
     */
    var $ordering = null;

    /**
     * @var int
     */
    var $checked_out = null;  
    
    /**
     * @var datetime
     */
    var $checked_out_time = null; 
    
    /**
     * Constructor
     *
     * @param object Database connector object
     * @since 1.0 
     */
    function __construct(& $db) {
        parent::__construct('#__mwc_employee', 'id', $db);
    }

    /**
    * Overloaded bind function
    *
    * @acces public
    * @param array $hash named array
    * @return null|string    null is operation was satisfactory, otherwise returns an error
    * @see JTable:bind
    * @since 1.5
    */
    function bind($array, $ignore = '')
    {
        
        $datenow =& JFactory::getDate();
            $array['created']= $datenow->toFormat("%Y-%m-%d-%H-%M-%S");
        if (key_exists( 'params', $array ) && is_array( $array['params'] ))
        {
            $registry = new JRegistry();
            $registry->loadArray($array['params']);
            $array['params'] = $registry->toString();
        }

        return parent::bind($array, $ignore);
    }    
}
